package org.aphelie.chronicle.ui.forms;

import org.aphelie.chronicle.ui.editors.ArcFormEditor;
import org.aphelie.chronicle.ui.editors.ArcFormPage;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.SectionPart;
import org.eclipse.ui.forms.widgets.FormToolkit;

public class ArcFormSection extends SectionPart implements IContextPart, IAdaptable, IArcModelChangedListener {
	
	private ArcFormPage page;
	
	public ArcFormSection(ArcFormPage page, Composite parent, int style) {
		super(parent, page.getManagedForm().getToolkit(), style);
		this.page = page;
	}
	
	public ArcFormSection(ArcFormSection section) {
		super(section.getSection());
	}
	
	protected FormToolkit getToolkit() {
		return getManagedForm().getToolkit();
	}
	
	ArcFormEditor getEditor() {
		return (ArcFormEditor) page.getEditor();
	}

	@Override
	public boolean isEditable() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public ArcFormPage getPage() {
		return page;
	}

	@Override
	public String getContextId() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void fireSaveNeeded() {
		markDirty();
	}

	@Override
	public void cancelEdit() {
		// TODO Auto-generated method stub
		
	}

	@SuppressWarnings("rawtypes")
	@Override
	public Object getAdapter(Class adapter) {
		// TODO Auto-generated method stub
		return null;
	}


	
	
}
